package com.aaa.rent.service.impl;/**
 * Date:2023/3/1
 * Author：臣哥哥
 * Description:
 */

import com.aaa.entity.Brand;
import com.aaa.entity.CarTypeConfigDetails;
import com.aaa.rent.dao.CarTypeConfigDetailsDao;
import com.aaa.rent.service.CarTypeConfigDetailsService;
import com.aaa.vo.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author     ：Xiaochen
 * @date       ：Created in 2023/3/1 16:20
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class CarTypeConfigDetailsServiceImpl implements CarTypeConfigDetailsService {
    @Autowired
    private CarTypeConfigDetailsDao carTypeConfigDetailsDao;
    @Override
    public Result selectAll(Integer currentPage, Integer pageSize, CarTypeConfigDetails carTypeConfigDetails) {
        PageHelper.startPage(currentPage,pageSize);
        List<CarTypeConfigDetails> configDetails = carTypeConfigDetailsDao.selectAll(carTypeConfigDetails);
        PageInfo<CarTypeConfigDetails> carTypeConfigDetailsPageInfo = new PageInfo<>(configDetails);
        System.out.println("users ==================== " + carTypeConfigDetailsPageInfo);
        return new Result(2000,"成功",carTypeConfigDetailsPageInfo);
    }

    @Override
    public Result update(CarTypeConfigDetails carTypeConfigDetails) {
        int i = carTypeConfigDetailsDao.updateById(carTypeConfigDetails);
        return new Result(2000,"成功",i);
    }

    @Override
    public Result delete(Integer id) {
        int i = carTypeConfigDetailsDao.deleteById(id);
        return new Result(2000,"成功",i);
    }

    @Override
    public Result insert(CarTypeConfigDetails carTypeConfigDetails) {
        int insert = carTypeConfigDetailsDao.insert(carTypeConfigDetails);
        return new Result(2000,"成功",insert);
    }

    @Override
    public Result selectConfig() {
        List<CarTypeConfigDetails> carTypeConfigDetails = carTypeConfigDetailsDao.selectList(null);
        return new Result(2000,"成功",carTypeConfigDetails);
    }
}